Support deficon on write of track and routepoints in KML.
authorrobertl <robertl>
Wed, 29 Oct 2008 16:43:44 +0000 (16:43 +0000)
committerrobertl <robertl>
Wed, 29 Oct 2008 16:43:44 +0000 (16:43 +0000)
kml.c

diff --git a/kml.c b/kml.c
index 286a61038403c63e295e6ea3fb45fbb9ea73d0d7..0de45c600cc46203abd080987db64e331233704c 100644 (file)
--- a/kml.c
+++ b/kml.c
@@ -681,7 +681,17 @@ static void kml_output_point(const waypoint *waypointp, kml_point_type pt_type)
        kml_output_lookat(waypointp);
        kml_output_timestamp(waypointp);
 
-       if (trackdirection && (pt_type == kmlpt_track)) {
+
+        if (opt_deficon) {
+               kml_write_xml(1, "<Style>\n");
+               kml_write_xml(1, "<IconStyle>\n");
+               kml_write_xml(1, "<Icon>\n");
+               kml_write_xml(0, "<href>%s</href>\n", opt_deficon);
+               kml_write_xml(-1, "</Icon>\n");
+               kml_write_xml(-1, "</IconStyle>\n");
+               kml_write_xml(-1, "</Style>\n");
+        } else {
+          if (trackdirection && (pt_type == kmlpt_track)) {
                char buf[100];
                if (waypointp->speed < 1) 
                        snprintf(buf, sizeof(buf), "%s-none", style);
@@ -689,9 +699,10 @@ static void kml_output_point(const waypoint *waypointp, kml_point_type pt_type)
                        snprintf(buf, sizeof(buf), "%s-%d", style, 
                                (int) (waypointp->course / 22.5 + .5) % 16);
                kml_write_xml(0, "<styleUrl>%s</styleUrl>\n", buf);
-       } else {
+         } else {
                kml_write_xml(0, "<styleUrl>%s</styleUrl>\n", style);
-       }
+         }
+        }
 
        kml_write_xml(1, "<Point>\n");
         if (floating) {